import { apiUrl, productionTip } from '@/api/url'
import $http from './http'

// 获取分类
export const getCategories = (params) =>
  $http.post(`${apiUrl.wapi}api/helpcenter/helpcenter/sections`, params)

// 获取最新文章
export const getRecentArticles = (params) =>
  $http.post(`${apiUrl.wapi}api/helpcenter/helpcenter/recent-articles`, params)

// 获取菜单
export const getMenu = (params) => {
  return $http.post(`${apiUrl.wapi}api/helpcenter/helpcenter/menu`, params)
}

// 获取菜单
export const getNewMenu = (params) => {
  return $http.post(`${apiUrl.wapi}api/helpcenter/helpcenter/new-menu`, params)
}

// 获取分类下的文章
export const getCategoryArticles = (params) => {
  return $http.post(
    `${apiUrl.wapi}api/helpcenter/helpcenter/category-articles`,
    params
  )
}
// 获取二级分类下的最新文章
export const getSectionRecentArticles = (params) => {
  return $http.post(
    `${apiUrl.wapi}api/helpcenter/helpcenter/section-recent-articles`,
    params
  )
}
// 获取二级分类下的文章
export const getSectionArticles = (params) => {
  return $http.post(
    `${apiUrl.wapi}api/helpcenter/helpcenter/section-articles`,
    params
  )
}
// 获取文章详情
export const getArticleDetail = (params) => {
  return $http.post(
    `${apiUrl.wapi}api/helpcenter/helpcenter/article-detail`,
    params
  )
}
// 搜索
export const search = (params) => {
  return $http.post(`${apiUrl.wapi}api/helpcenter/helpcenter/search`, params)
}
// blog
export const blogApi = {
  // blog 二级分类列表
  sections: (params) => {
    return $http.post(`${apiUrl.wapi}api/helpcenter/blogcenter/list-sections`, params)
  },
  // blog 文章列表
  articles: (params) => {
    return $http.post(`${apiUrl.wapi}api/helpcenter/blogcenter/section-articles`, params)
  },
  // blog 文章详情
  articleDetail: (params) => {
    return $http.post(`${apiUrl.wapi}api/helpcenter/blogcenter/article-detail`, params)
  },
  // blog 文章搜索
  search: (params) => {
    return $http.post(`${apiUrl.wapi}api/helpcenter/blogcenter/search`, params)
  },
  // blog 热门文章
  hotArticles: () => {
    return $http.post(`${apiUrl.wapi}api/helpcenter/blogcenter/hot-articles`)
  },
  // blog 更多文章
  moreArticles: (params) => {
    return $http.post(`${apiUrl.wapi}api/helpcenter/blogcenter/section-more-articles`, params)
  },
}
// 上币专区
export const symbolZoneApi = {
  // 上币专区 文章列表
  articles: (params) => {
    return $http.post(`${apiUrl.wapi}api/currencyanalysis/report/list`, params)
  },
  // 上币专区 文章详情
  articleDetail: (params) => {
    return $http.post(`${apiUrl.wapi}api/currencyanalysis/report/article-detail`, params)
  },
  // 上币专区 文章搜索
  search: (params) => {
    return $http.post(`${apiUrl.wapi}api/currencyanalysis/report/search`, params)
  },
  // 上币专区 热门文章
  hotArticles: (params) => {
    return $http.post(`${apiUrl.wapi}api/currencyanalysis/report/list`, params)
  },
  // 上币专区 更多文章
  moreArticles: (params) => {
    return $http.post(`${apiUrl.wapi}api/currencyanalysis/report/list`, params)
  },
  // 上币专区 根据币种获取文章
  getArticleDetailBySymbol: (params) => {
    return $http.post(`${apiUrl.wapi}api/currencyanalysis/report/article-by-symbol`, params)
  }
}